﻿var parametreKisi=null;

function ilanListesiGetir() {
    var ilanMetni = "";
    ajaxCalistir({}, "mainFuncs.aspx/ilanMetniGetir", function (data) {
        $('#bannerBaslik').html(data.d.replace("\n", "<br/>"))
        ekranAc();
        ilanGetir();
    });
}
function IlanBul() {
    $('#divIlanlar li').removeHighlight();
    var src = $('#txtIlanBul').val();
    $('#divIlanlar li').highlight(src);
}
function ilanGetir() {
    var ilanMetni = "";
    ajaxCalistir({}, "mainFuncs.aspx/ilanListele", function (data) {
        $('#divIlanlar li').remove();
        if (data.d != null) {
            $.each(data.d, function (k, v) {
                var ht = '<li class="triangle-isosceles">' + v.ilanMetni + '</li>';
                $('#ilanul').append(ht);
                ekranAc();
            });
        }

        ekranAc();
    });
}
function CreateNewLikeButton(url, container) {
    var elem = $(document.createElement("fb:like"));
    elem.attr("href", url);
    elem.attr("data-send", false);
    //    elem.attr("width", "500px");
    //    elem.attr("height", "100px");
    //    elem.attr("float", "left");
    $('#' + container).empty().append(elem);
    if (typeof FB != "undefined") {
        FB.XFBML.parse($('#' + container).get(0));
    }
}
function CreateNewLikeButton2(container) {
    //    var elem = $(document.createElement("fb:like"));
    //    elem.attr("href", url);
    //    elem.attr("data-send", true);
    //    //    elem.attr("width", "500px");
    //    //    elem.attr("height", "100px");
    //    //    elem.attr("float", "left");
    //    $('div#' + container).empty().append(elem);
    if (typeof FB != "undefined") {
        FB.XFBML.parse($('#' + container).get(0));
    }
    
}
function twitterbuttonYarat() {
    $('.twitter-share-button').each(function (k, v) {
        var tweet_button = new twttr.TweetButton($(this).get(0));
        tweet_button.render();
    });
}
function twttrr() {
    !function (d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (!d.getElementById(id)) {
            js = d.createElement(s); js.id = id;
            js.src = "//platform.twitter.com/widgets.js";
            fjs.parentNode.insertBefore(js, fjs);
        }
    }
(document, "script", "twitter-wjs");

}
function bilgiEkrani(id, ad, soyad, video, resim,akid) {
    ajaxCalistirAnket({ id: id }, "anketFuncs.aspx/bilgiGetir", function (data) {
        var bilgi = data.d;
      //  var faceDiv = '<div style="float:left;width:100px;height:18px"><div  id="faceBegen' + akid + '" class="fb-like" data-href="http://www.sosyalmedyahaber.org/anket.aspx?akid=' + id + '" data-send="false" data-layout="button_count" data-width="130" data-show-faces="false"></div></div></div>';
        var faceDiv2 = '<div style="float:left;width:100px;height:18px"><div  id="faceBegen2' + akid + '" class="fb-like" data-href="http://www.sosyalmedyahaber.org/anket.aspx?akid=' + id + '" data-send="false" action="recommend" data-layout="button_count" data-width="130" data-show-faces="false"></div></div>';
        var eurl = encodeURIComponent('http://' + window.location.host + '/anket.aspx?akid=' + id);
        var tw = '<div style="float:left;width:120px;height:20px"><iframe allowtransparency="true" frameborder="0"  data-via="sosyalmedyahaber" scrolling="no" data-text="" src="//platform.twitter.com/widgets/tweet_button.html?url=' + eurl + '&text=sosyalmedyahaber.org&lang=tr" style="width:120px;height:20px;float:left"></iframe></div>';
       // var send = '<div style="float:left;width:350px"><div style="float:left;width:100px"><div style="width:80px" id="tfbbhl" class="fb-send" data-href="http://sosyalmedyahaber.org/anket.aspx?akid=' + id + '"   data-width="110" data-show-faces="false"></div></div>';
       // var gp = '<div style="float:left;width:80px;height:18px"><g:plusone  size="medium" href="http://' + window.location.host + '/anket.aspx?akid=' + id + '"></g:plusone></div>';


        $('#bd').dialog("destroy");
        $('#bd').html('');
        var ht = '<div class="solyuzdeyuz"><div style="float:left;width:45%"><div style="margin-top:10px;display:inline-block" class="ui-widget-header">' + ad + ' ' + soyad + ' </div> <div id="bilgiResimler" style="float:left:width:50%;margin-top:10px;"></div><div style="float:left:width:100%;margin-top:10px;"><video class="vid" id="anketvideo' + id + '" src="/anketVideo/' + video + '" width="200" height="160" > </video></div></div><div style="width:49%;float:left">' + bilgi + '</div> </div>';

        $('#bd').append('<div style="float:left;width:100%">'+ tw + faceDiv2 + '</div>');


        $('#bd').append(ht);


        $('#bd').dialog({
            width: 600,
            height: 500,
            modal: true,
            autoOpen: false,
            position: [250, 250],
            buttons: {
                "Kapat": function () { $(this).dialog("close"); }
            }, open: function () {
                CreateNewLikeButton('faceBegen' + akid);
                ///CreateNewLikeButton2('faceBegen' + akid);
                CreateNewLikeButton2('faceBegen2' + akid);
            }
        });

        if (resim != null) {
          
            var re = '<img id="bres" class="bres" src="' + resim[0] + ' "width="200" height="180" />';
            $('#bilgiResimler').append(re);

            $('#bres').click(function () {
                var resimz = new Array();
                $.each(resim, function (k, v) {
                    resimz.push('http://' + window.location.host + v);

                });
                $.fancybox(
                    resimz, {
                        'padding': 0,
                        'transitionIn': 'none',
                        'transitionOut': 'none',
                        'type': 'image',
                        'changeFade': 0,
                        'autoScale': true,
                        'width': 300,
                        'height': 300
                    });

            });

        }



        videoElementOlustur2("anketvideo" + id);



//        var gphtml = '    <script type="text/javascript">    window.___gcfg = { lang: "tr" };    (function () {' +
//                    'var po = document.createElement("script"); po.type = "text/javascript"; po.async = true;' +
//                   ' po.src = "https://apis.google.com/js/plusone.js";' +
//                  '  var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(po, s);' +
//                   ' })();            </script>';
//        $('#bd').append(gphtml);
        $('#bd').dialog("open");
        CreateNewLikeButton2('faceBegen' + akid);
        CreateNewLikeButton2('faceBegen2' + akid);


    });
    ekranAcAnket();
}
function istatistikGetir() {
    ajaxCalistirAnket({}, "mainFuncs.aspx/onlineKullaniciSayisi", function (data) {
        $('#counter').html('');
        $('#counter').append('<div>Aktif Kullanıcı : ' + data.d.aktif + '</div>');
        $('#counter').append('<div>Toplam Kullanıcı : ' + data.d.toplam + '</div>');
        $('#counter').append('<div>Ulaşabildiğimiz Kullanıcı  : ' + data.d.sosyal + '</div>');

    });

}
function yillariGetir() {
    $('select#cmbyil').selectmenu('destroy');
    var jsons = { };
    $.ajax({
        type: "POST",
        contentType: "application/json; charset=utf-8",
        url: "anketFuncs.aspx/yillariGetir",
        data: $.toJSON(jsons),
        dataType: "json",
        success: function (data, textStatus) {
            
            var opt = {width:450, change: function () { anketleriGetir($(this).val()); } }
            $('select#cmbyil').selectmenu({
            }).populateDropDown(data.d, opt);
            var v = data.d[data.d.length - 1].val;
            $('select#cmbyil').selectmenu("value", v);
            yil = $('select#cmbyil').selectmenu("value");
            anketleriGetir(v);

        },
        error: function (xhr, data, textStatus) {
            hataver(xhr, status, Error);
        }
    });
}
function oykullan(anketID, kisiID) {

    ajaxCalistirAnket({ anketID: anketID, KisiID: kisiID }, "anketFuncs.aspx/oyKullan", function (data) { ekranAcAnket();  });
    $('#anket' + anketID + ' .oykullancls').each(function (k, v) {
        $(this).unbind("click");
        $(this).html('<div class="ui-state-default">Oy Kullanıldı</div>').css("cursor", "default");

    });
    $('#anketdiger' + anketID + ' .oykullancls').each(function (k, v) {
        $(this).unbind("click");
        $(this).html('<div class="ui-state-default">Oy Kullanıldı</div>').css("cursor", "default");

    });
    $('#oysayisi' + kisiID+''+anketID).html(parseInt($('#oysayisi' + kisiID+''+anketID).html()) + 1);
    $('#oysayisidiger' + kisiID+''+anketID).html(parseInt($('#oysayisi' + kisiID+''+anketID).html()) + 1);

}
var yil = 2012;
function anketKategoriGetir() {
    ajaxCalistirAnket({}, "anketFuncs.aspx/varsayilanAnket", function (data) {
        if (data.d != null) {
            var tw = data.d[0].twitteradresi == null ? "" : '<div style="float:left;width:110px"> <iframe allowtransparency="true" frameborder="0" scrolling="no" src="//platform.twitter.com/widgets/follow_button.html?screen_name=' + data.d[0].twitteradresi + '&lang=tr" style="width:95px; float:left;height:20px;padding-left:5px"></iframe></div>';
            var tw2 = data.d[0].twitteradresi == null ? "" : '<div style="float:left;width:20px;margin-left:4px"><a href="http://www.twitter.com/' + data.d[0].twitteradresi + '" target=_blank ><img height=20px width=20px src="./Styles/Twitter-icon2.png" alt="Twitter Sayfamızı Ziyaret Edin"/></a></div>';
            var fb = data.d[0].facebookadresi == null ? "" : '<div style="float:left;width:100px;height:20px"><div id="fbbanket" class="fb-like" data-href="' + data.d[0].facebookadresi + '" data-send="false" data-layout="button_count" data-width="80" data-show-faces="false"></div></div>';
            var gp = data.d[0].gplusno == null ? "" : '<div style="float:left;width:20px;margin-left:4px"><a href="http://plus.google.com   /' + data.d[0].gplusno + '" target=_blank ><img height=20px width=20px src="./Styles/gplus.png" alt="Google Plus Sayfamızı Ziyaret Edin"/></a></div>';
            var fb2 = data.d[0].facebookadresi == null ? "" : '<div id="fbbtnanket1"  class="curr fbbtnAnket123" style="width:24px;float:left" ><img width="20" height="20" src="./Styles/FaceBook_32x32.png" alt="Facebook Sayfamızı Ziyaret Edin"/></div>';
            var ht = '<div style="float:left;margin-left:80px;margin-top:1px;width:90%">' + gp + tw2 + tw + fb2 + fb + '</div>';
            

         
            var eurl = encodeURIComponent('http://' + window.location.host + '/anket.aspx?a='+yil);
            var twt = '<div style="float:left;width:100px;margin-left:4px"><iframe allowtransparency="true" frameborder="0"  data-via="sosyalmedyahaber" scrolling="no" data-text="' + yil + 'YILININ KENDİ DALLARINDA ÖNE ÇIKANLARI" http://' + window.location.host + '/anket.aspx?a=' + yil + '" src="//platform.twitter.com/widgets/tweet_button.html?url=' + eurl + '&text=sosyalmedyahaber.org&lang=tr" style="float:left;width:90px; height:20px;"></iframe></div>';
            var fbb = '<div style="float:left;width:60px"><div style="width:50px" id="fbKategori" class="fb-like" data-href="http://' + window.location.host + '/anket.aspx?a=' + yil + '" data-send="false" data-layout="button_count" data-width="110" data-show-faces="false"></div></div>';
            var fbb2 = '<div style="float:left;width:80px"><div style="width:50px" id="fbKategori2" class="fb-like" data-href="http://' + window.location.host + '/anket.aspx?a=' + yil + '" data-send="false" data-layout="button_count" action="recommend" data-width="110" data-show-faces="false"></div></div>';
            var gpp = '<div style="float:left;width:50px;margin-left:4px"><g:plusone size="small" href="http://' + window.location.host + '/anket.aspx?a=' + yil + '"></g:plusone></div> ';
            var send = '<div style="float:left;width:70px"><div style="width:80px" class="fb-send" data-href="http://' + window.location.host + '/anket.aspx?a=' + yil + '" data-send="false"  data-width="110" data-show-faces="false"></div></div>';
            $('#divSosyalEklentiler').append(gpp).append(twt).append(send).append(fbb2).append(fbb);

            $('#ss2 ').append(ht);
            $('#fbbtnanket1').click(function () { fbEkraniOlustur(data.d[0].facebookadresi); });
           // CreateNewLikeButton2('fbKategori');
           // CreateNewLikeButton2('fbKategori2');
        }
    });
}
function fbEkraniOlustur(adres) {
    var ht = '<div id="fblikeboxx" class="fb-like-box" data-href="' + adres + '" data-width="292" data-show-faces="true" data-stream="true" data-header="true"></div>';
    $('#fbIcerik').html('');
    $('#fbIcerik').append(ht);
    CreateNewLikeButton2('fbIcerik');
    $('#dialFbEkrani').dialog("open");
}
function anketleriGetir(yil) {

    ajaxCalistirAnket({ yil: yil }, "anketFuncs.aspx/anketleriGetir", function (data) {
        if (data.d != null) {
            $('.ustdiv').remove();
            //  ekranKilitle("Anketler Getiriliyor.");

            $.each(data.d, function (key, value) {

                // ank = '<div style="width:25%;height:200px;float:left" id="makeMeScrollable' + value.anketID + '"><div class="scrollingHotSpotLeft"></div><div class="scrollingHotSpotRight"></div><div class="scrollWrapper"><div id="anketdiger' + value.anketID + '" style="text-align:center;margin-top:5px;font-size:12px;float:left" class="scrollableArea fnt "></div></div></div>';
                if (value.adaylar != null) {
                    var ustDiv = '<div class="solyuzdeyuz ustdiv" id="ustDiv' + value.anketID + '"></div>';
                    var ustDivIlkBes = '<div id="ustdivilkbes' + value.anketID + '" class="ilkbes"></div>';
                    var ustDivDiger = '<div id="ustDivDiger' + value.anketID + '" class="digerAdaylar"></div>';
                    var baslik = ' <div class="anketbaslik ui-widget-header">' + value.anketAdi + '</div>';
                    var ank = '<div id="anket' + value.anketID + '" style="margin-bottom:5px;text-align:center;margin-top:5px;float:left;" class="anketcss  fnt ui-widget ui-widget-content"><div class="anketbaslik ui-widget-header">' + value.anketAdi + '</div></div>';

                    $('#haberAkis').append(ustDiv);

                    $('#ustDiv' + value.anketID).append(ustDivIlkBes);
                    $('#ustDiv' + value.anketID).append(ustDivDiger);
                    $('#ustdivilkbes' + value.anketID).append(ank);
                    var b = 6 * value.adaylar.length;
                    var w = (130 * value.adaylar.length) + b;
                    var a = (100 / value.adaylar.length) - 1;
                    var btm = key == 0 ? "margin-top:42px" : "margin-top:42px";
                    ank = '<div class="ui-widget ui-widget-content "  style="float:left;width:100%;height:100%;margin-top:5px"><div style="margin-top:0px;font-size:14px;text-align:center"class="anketbaslik ui-widget-header fnt">Adaylar</div><div id="scrollbar' + value.anketID + '" class="scrbar"><div class="viewport"><div id="anketdiger' + value.anketID + '" style="text-align:center;margin-top:5px;float:left;" class="anketcssdiger overview fnt ui-widget ui-widget-content"></div></div><div class="scrollbar"><div class="track"><div class="thumb"><div class="end"></div></div></div></div></div></div>';
                    $('#ustDivDiger' + value.anketID).append(ank);
                    $('#anketdiger' + value.anketID).css("width", w + "px");

                    $.each(value.adaylar, function (k, v) {
                        var resimler = "";
                        if (v.resim != null) {
                            resimler = v.resim.split(",");
                        }
                        if (k < 3) {
                            var oy = value.oyKullanabilir == true ? '<div id="oykullan' + v.id + '' + value.anketID + '" class="oykullancls ui-state-default">Oy Kullan</div>' : '<div style="float:left;width:100%" class="ui-state-default">Oy Kullanıldı</div>';
                            var ht = '<div id="aday' + v.id + '' + value.anketID + '" class="adaycss hovver" style="margin-left:5px;"><div class="ui-state-highlight solyuzdeyuz  " style="font-size:12px;font-weight:bold;color:red">' + (k + 1) + '</div><div style="font-weight:bold;font-size:11px" class="adayBaslik ui-widget-header ui-state-default hvvr">' + v.ad + ' ' + v.soyad + '</div><div style="float:left;width:62px;height:89px" class="ui-state-default"><div id="adayResimcss' + v.id + '' + value.anketID + '"  class="adayResimcss ui-state-default"><img width="60px" height="87px" style="float:left" src="' + resimler[0] + '" /></div></div><div class="paylasbtn" style="width:30px;float:left;padding-left:2px;margin-top:2px;" ><span style="width:100%;float:left;height:42px" class="spnbilgi ui-state-default hvvr" id="spnBilgi' + v.id + '' + value.anketID + '">Bilgi</span><div id="oysayisi' + v.id + '' + value.anketID + '" style="width:100%;float:left;height:40px;" class=" oysayisi ui-state-default hvvr">' + v.oySayisi + ' oy</div></div></div>';
                            $('#anket' + value.anketID).append(ht);
                            $('#spnBilgi' + v.id + '' + value.anketID).click(function () { bilgiEkrani(v.id, v.ad, v.soyad, v.video, resimler, v.anketKisiID); });
                            $('#adayResimcss' + v.id + '' + value.anketID).click(function () { bilgiEkrani(v.id, v.ad, v.soyad, v.video, resimler, v.anketKisiID); });
                            if (value.oyKullanabilir == true) {
                                $('#oykullan' + v.id + '' + value.anketID).click(function () { oykullan(value.anketID, v.id); });
                            }
                            $('#aday' + v.id + '' + value.anketID).hover(function (e) { $('#aday' + v.id + '' + value.anketID + ' .hvvr').removeClass("ui-state-default").addClass("turuncu") }, function () { $('#aday' + v.id + '' + value.anketID + ' .hvvr').removeClass("turuncu").addClass("ui-state-default"); });
                        }
                        oy = value.oyKullanabilir == true ? '<div  id="oykullandiger' + v.id + '' + value.anketID + '" class="oykullancls ui-state-default hvvr">Oy Kullan</div>' : '<div style="float:left;width:100%" class="ui-state-default">Oy Kullanıldı</div>';
                        ht = '<div id="adaydiger' + v.id + '' + value.anketID + '" class="adaycssdiger hovver" style="height:150px;margin-top:2px;margin-left:5px;width:' + a + 'px"><div style="font-size:10px;max-height:2.4em;font-weight:bold" class="adayBaslik ui-widget-header ui-state-default hvvr">' + v.ad + ' ' + v.soyad + '</div> <div style="float:left;width:68px;height:70px" class="ui-state-default"><div class="adayResimCssDiger ui-state-default"><img width="68px" height="87px" src="' + resimler[0] + '" /></div></div><div style="width:30px;float:left;padding-left:3px;margin-top:2px"><div class="paylasbtn solyuzdeyuz"><span class="spnbilgi ui-state-default hvvr" id="spnBilgidiger' + v.id + '' + value.anketID + '">Bilgi</span></div><div id="oysayisidiger' + v.id + '' + value.anketID + '" style="font-size:10;height:26px;padding-bottom:2px" class="solyuzdeyuz oysayisi ui-state-default hvvr">' + v.oySayisi + '</div></div>' + oy + '</div>';
                        $('#anketdiger' + value.anketID).append(ht);
                        $('#spnBilgidiger' + v.id + '' + value.anketID).click(function () { bilgiEkrani(v.id, v.ad, v.soyad, v.video, resimler, v.anketKisiID); });
                        $('#adayResimcssdiger' + v.id + '' + value.anketID).click(function () { bilgiEkrani(v.id, v.ad, v.soyad, v.video, resimler, v.anketKisiID); });
                        if (value.oyKullanabilir == true) {
                            $('#oykullandiger' + v.id + '' + value.anketID).click(function () { oykullan(value.anketID, v.id); });
                        }
                        $('#adaydiger' + v.id + '' + value.anketID).hover(function (e) { $('#adaydiger' + v.id + '' + value.anketID + ' .hvvr').removeClass("ui-state-default").addClass("turuncu") }, function () { $('#adaydiger' + v.id + '' + value.anketID + ' .hvvr').removeClass("turuncu").addClass("ui-state-default"); });
                        var p = null;
                        p = parametreGetir("akid");

                        if (p != null && p == v.id) {
                            parametreKisi = { id: v.id, ad: v.ad, soyad: v.soyad, video: v.video, resimler: resimler, anketKisiID: v.anketKisiID };
                        }
                    });

                    $('#scrollbar' + value.anketID).tinyscrollbar({ axis: 'x' });
                    var eurl = encodeURIComponent('http://www.sosyalmedyahaber.org/anket.aspx?anket=' + value.anketID);
                    //var faceDiv = '<div style="float:left;width:70px"><div id="faceBegen' + value.anketID + '" class="fb-like" data-href="' + eurl + '" href="' + eurl + '" data-send="false" data-layout="button_count" data-width="100" data-show-faces="false"></div></div>';
                    var faceDiv2 = '<div style="float:left;width:80px"><div id="faceBegen2' + value.anketID + '" class="fb-like" data-href="' + eurl + '" href="' + eurl + '" action="recommend" data-send="false" data-layout="button_count" data-width="80" data-show-faces="false"></div></div>';
                    //var send = '<div style="float:left;width:70px"><div style="width:80px" class="fb-send" data-href="' + eurl + '" data-send="false"  data-width="110" data-show-faces="false"></div></div>';

                    var tw = '<div style="float:left;width:100px"><iframe allowtransparency="true" frameborder="0"  data-via="sosyalmedyahaber" scrolling="no" data-text="" src="//platform.twitter.com/widgets/tweet_button.html?url=' + eurl + '&text=sosyalmedyahaber.org&lang=tr" style="float:left;width:130px; height:20px;z-index:9999"></iframe></div>';
                    //CreateNewLikeButton2('faceBegen' + value.anketID);
                    //var gp = '<div style="float:left;width:60px;"><g:plusone size="small" href="http://' + window.location.host + '/anket.aspx?anket=' + value.anketID + '"></g:plusone></div>';
                   

                    //                    var buttonz = '<div style="float:left;width:100%"><span style="float:left;margin-right:3px;font-weight:bold" class="kirmizigolgeli fnt">ANKET DALININ HABERİNİ YANDAKİ SOSYAL EKLENTİLERDEN PAYLAŞABİLİRSİNİZ.</span> ' + gp + tw + send + faceDiv2 + faceDiv + '</div>';
                    var buttonz = '<div style="float:left;width:100%"><span style="float:left;margin-right:3px;font-weight:bold" class="kirmizigolgeli fnt">ANKET DALININ HABERİNİ YANDAKİ SOSYAL EKLENTİLERDEN PAYLAŞABİLİRSİNİZ.</span> ' + tw + faceDiv2  + '</div>';

                    $('#ustDiv' + value.anketID).append(buttonz);


                    // CreateNewLikeButton(window.location.host + '/anket.aspx?anket=' + value.anketID, 'faceBegen' + value.anketID);
      
                }

                
                ekranAcAnket();
                // $('.hovver > div').hover(function (e) { $(this).parent().addClass("ui-state-highlight "); }, function () { $(this).parent().removeClass("ui-state-highlight "); });

            });
            var p = parametreGetir("anket");
            if (p != "") {
                var t = $('#ustDiv' + p).position().top;
                $(window).scrollTop(t);
            } else {
                if (parametreKisi != null) {
                    bilgiEkrani(parametreKisi.id, parametreKisi.ad, parametreKisi.soyad, parametreKisi.video, parametreKisi.resimler, parametreKisi.anketKisiID);
                }
            }
        } else {
            $('#haberAkis').html('Tanımlanmış anket bulunamadı...');

        }
        CreateNewLikeButton('faceBegen');
        ekranAcAnket();
    });
}
function yazarListesiGetir() {
    var ilanMetni = "";
    ajaxCalistir({}, "mainFuncs.aspx/yazarGetir", function (data) {
        $('#bannerBaslik2').html('<div class="solyuzdeyuz fnt triangle-isoscelesy" style="text-align:justify;font-size:11px;width:98%" ><div class="solyuzdeyuz" style="text-align:center;margin-bottom:0px">YAZARLARIMIZ</div>Sizde Kendi Alanınızda Yeteneğinize Güveniyorsanız,  Bu Alandaki Düşüncelerinizi Ve Haberlerinizi Okuyucularımızla Paylaşmayı Düşünüyorsanız. Bizimle İletişime Geçerek Belirlediğiniz Bir Veya Birkaç Sosyal Medya Haber Sayfalamızdan  Bir Yönetim Paneli Alıp Kendi Okuyucu Kitlenizi Oluşturabilir, Sayfamızın Gönüllü Yazarı Veya Temsilcisi Olabilirsiniz.</div>');

        if (data.d != null) {
            for (var i = 0; i < data.d.length; i++) {
                var ht = '<div style="float:left;width:140px;overflow:hide;height:40px" class="uiListLight triangle-isosceles"><span style="width:60px;float:left;margin-top:5px"><img width="50" height="50"  src="http://' + window.location.host + '/yazarFoto/' + data.d[i].resim + '" alt="Yazar Resim" /></span><span class="fnt" style="width:40%;float:left;font-size:11px;margin-top:5px">' + data.d[i].username + '</span>' + '<span class="fnt" style="width:40%;float:left;font-size:11px">' + (data.d[i].meslek == null ? "" : data.d[i].meslek) + '</span></div>';

                $('#divIlanlar2').append(ht);
            }

        }

    });
}
$(document).ready(function () {


    if ($(window).width() > 1249) {

        var l = (($(window).width() - 1250) / 2) + 943 + "px";
        var r = (($(window).width() - 1250) / 2) + 1288 + "px"
        $('#sagScrl').css("left", l).css("position", "fixed").css("width", "340px").css("margin-top", 29 + "px");
        $('#divBannerEkrani').css("left", r);
        $('#kontrolPaneli').width($('#fScreen').width() + 85);
        $('#divBannerEkrani2').css("left", (($(window).width() - 1250) / 2) - 25);
        $('.digerAdaylar').css("width", "62%");
        //$('.u').css("width","96%");
        $('.u').width($('#AnaSayfaOrta').width() - 40).css("position", "fixed");
        $('#ustBaslik').css("margin-top", "75px");
        $('#ustBaslik2').css("margin-top", "114px");
        $('#ustBaslik3').css("margin-top", "160px");
        $('#AnaSayfaOrta').css("margin-top", "187px");
      //  $('#counter').css("position", "absolute");

    } else {
        $('#kontrolPaneli').width($('#fScreen').width() + 47);
        $('#sagScrl').css("position", "static").css("margin-left", 0 + "px").css("float", "left").css("min-width", "300px").css("width", "330px").css("margin-top", 0 + "px");
        $('#divBannerEkrani').css("left", $(window).width() - 20);
        $('.digerAdaylar').css("width", "550px");
        $('.u').css("width", "900px").css("position", "static").css("margin-top", "0px");
        $('#ustBaslik').css("margin-top", "75px");
        $('#ustBaslik2').css("margin-top", "5px");
        $('#ustBaslik3').css("margin-top", "5px");
       // $('#counter').css("position", "absolute");
        $('#AnaSayfaOrta').css("margin-top", "5px");
    }
    $('#btnBanner').html($('#btnBanner').text().replace(/(.)/g, "$1<br />"));
    $('#btnBanner2').html($('#btnBanner2').text().replace(/(.)/g, "$1<br />"));
    $("#bannerClik2").toggle(function () {
        $('#divIlanlar2').show();
        //$('#divIlanBul2').show();
        $('#bannerBaslik2').show();
        $('.baslikKategori').css("z-index", "0");
        var r = (($(window).width() - 1250) / 2) - 20;
        if ($(window).width() < 1250) {
            r = 0;
        }
        $("#divBannerEkrani2").animate({ "left": r, "width": 460 }, 1000);
        $('.bannerok2').html('<img  src="Styles/images/solok.png" width="20px" height="20px" />');

    }, function () {
        $('#divIlanlar2').hide();
        //$('#divIlanBul2').hide();
        $('#bannerBaslik2').hide();
        $
        var r = (($(window).width() - 1250) / 2) - 20;
        if ($(window).width() < 1250) {
            r = 0;
        }
        $('.bannerok2').html('<img  src="Styles/images/sagok.png" width="20px" height="20px" />');
        $("#divBannerEkrani2").animate({ "left": r, "width": 20 }, 1000, "", function () {
            $('.baslikKategori').css("z-index", "99999");
        });

    });

    $("#bannerClik").toggle(function () {
        $('#divIlanlar').show();
        $('#divIlanBul').show();
        $('#bannerBaslik').show();
        var r = (($(window).width() - 1250) / 2) + 1308;
        if ($(window).width() < 1250) {
            r = $(window).width() - 20;
        }
        $("#divBannerEkrani").animate({ "left": r - 370, "width": 370 }, 1000);
        $('.bannerok1').html('<img  src="Styles/images/sagok.png" width="20px" height="20px" />');
    }, function () {
        $('#divIlanlar').hide();
        $('#divIlanBul').hide();
        $('#bannerBaslik').hide();
        var r = (($(window).width() - 1250) / 2) + 1288;
        if ($(window).width() < 1250) {
            r = $(window).width() - 20;
        }
        $('.bannerok1').html('<img  src="Styles/images/solok.png" width="20px" height="20px" />');
        $("#divBannerEkrani").animate({ "left": r, "width": 20 }, 1000);
    });
    $('#btnIlanAra').button().click(function () {
        IlanBul();
    });

    ilanListesiGetir();
    yazarListesiGetir();
    $('#txtIlanBul').keypress(function (e) {

        if (e.which == 13) {

            IlanBul();
        }
    });
    var b = $('#divReklamlar').height() + $('#counter').height() + 310;


    $('#yayinAkisi').height($(window).height() - b);

    videoGetir();
    $('#btnAnaSayfa').click(function () {
        var json = { sparam: "seciliKategori", s: null };
        $.ajax({
            type: "POST",
            contentType: "application/json; charset=utf-8",
            url: "mainFuncs.aspx/SessionYaz",
            data: $.toJSON(json),
            dataType: "json",
            success: function (data) {
             window.location = "Default.aspx";
            },
            error: function (xhr, data, textStatus) {

            }
        });
       
    });

    yayinListesiGetir();
    yillariGetir();
    $('#btnAnket').click(function () {
        window.location = "anket.aspx";
    });
    $('#btnIletisim').click(function () {
        window.location = "iletisim.aspx";
    });
    $('#btnAnketleriGetir').button().click(function () {
        anketleriGetir($('#cmbyil').val());
    });

    ajaxCalistirAnket({}, "mainFuncs.aspx/reklamZamaniGetir", function (data) {
        reklamDegisimZamani = data.d;
    });

    anketKategoriGetir();
    istatistikGetir();
    reklamlariGetir();
//    reklamSayiArttir("y1");
//    reklamSayiArttir("y2");
//    reklamSayiArttir("t");
    $('#dialFbEkrani').dialog({
        width: 350,
        height: 500,
        modal: true,
        autoOpen: false,
        buttons: {
            "Kapat": function () { $(this).dialog("close"); }
        }
    });

});


function reklamSayiArttir(alanTipi) {
    var json = { alanAdi: alanTipi };
    $.ajax({
        type: "POST",
        contentType: "application/json; charset=utf-8",
        url: "mainFuncs.aspx/reklamSayacArttir",
        data: $.toJSON(json),
        dataType: "json",
        success: function (data) {
        },
        error: function (xhr, data, textStatus) {

        }
    });
}
$(window).resize(function () {

 //   $('.fScreen').css("width", $(window).width() - 10);
  //  $('.kapla').css("height", $(window).height() - 50);
    ekranAyarla();
   // $('#AnaSayfaSol').tinyscrollbar();


});
$(window).scroll(function () {
  //  ekranAyarla();

});
function ekranAyarla() {

    if ($(window).width() > 1249) {

        var l = (($(window).width() - 1250) / 2) + 943 + "px";
        var r = (($(window).width() - 1250) / 2) + 1288 + "px"
        $('#sagScrl').css("left", l).css("position", "fixed").css("width", "340px").css("margin-top", 29 + "px");

        $('#divBannerEkrani').css("left", r);
        $('#kontrolPaneli').width($('#fScreen').width() + 85);
        $('#divBannerEkrani2').css("left", (($(window).width() - 1250) / 2) - 25);
        $('.digerAdaylar').css("width", "62%");
        //$('.u').css("width","96%");
        $('.u').width($('#AnaSayfaOrta').width() - 40).css("position", "fixed");
        $('#ustBaslik').css("margin-top", "75px");
        $('#ustBaslik2').css("margin-top", "114px");
        $('#ustBaslik3').css("margin-top", "160px");
        $('#AnaSayfaOrta').css("margin-top", "187px");
        //$('#counter').css("position", "absolute");
        
    } else {
        $('#kontrolPaneli').width($('#fScreen').width() + 47);
        $('#sagScrl').css("position", "static").css("margin-left", 0 + "px").css("float", "left").css("min-width", "300px").css("width", "330px").css("margin-top", 0 + "px");
        $('#divBannerEkrani').css("left", $(window).width() - 20);
        $('.digerAdaylar').css("width", "550px");
        $('.u').css("width", "900px").css("position", "static").css("margin-top", "0px");
        $('#ustBaslik').css("margin-top", "75px");
        $('#ustBaslik2').css("margin-top", "5px");
        $('#ustBaslik3').css("margin-top", "5px");
      //  $('#counter').css("position", "absolute");
        $('#AnaSayfaOrta').css("margin-top", "5px");
    }

 
//    $('.divReklamTv').css('top', ($(this).scrollTop() + 10) + "px");
//    $('.AnaSayfaOrta').css('height', ($(window).height() - 90) + "px");
//    $('.AnaSayfaOrta').css('max-height', ($(window).height() - 90) + "px");
//    // $('.AnaSayfaSol').css('height', ($(window).height() - 190) + "px");
//    $('.AnaSayfaSol').css('top', ($(this).scrollTop()) + "px");
}

function videoGetir() {
    //ekranKilitle("Video Yükleniyor");
    var json = {};
    $.ajax({
        type: "POST",
        contentType: "application/json; charset=utf-8",
        url: "mainFuncs.aspx/tvVideoGetir",
        data: $.toJSON(json),
        dataType: "json",
        success: function (data) {
            ekranAcAnket();
            if (data.d != null) {
                videoElementOlustur(data.d)
            }
        },
        error: function (xhr, data, textStatus) {
            ekranAcAnket();
            hataver(xhr, status, Error);
        }
    });
}
var yarim1 = "";
var yarim2 = "";
var tamboy = "";
function reklamlariGetir() {

    var json = {};
    $.ajax({
        type: "POST",
        contentType: "application/json; charset=utf-8",
        url: "mainFuncs.aspx/reklamTanimlariGetir",
        data: $.toJSON(json),
        dataType: "json",
        success: function (data) {
            $('#divReklamlar').html('');


            var i = 0;
            if (data.d != null) {

                var eurl, baslik, fb, gp, tw;
                if (data.d.tamboyAcik == 'T') {
                    eurl = encodeURIComponent('http://' + window.location.host + '/reklamResimleri/t/' + data.d.tamboyresim);
                    baslik = '<div class="fnt solyuzdeyuz" style="font-size:11px;font-weight:bold;margin-top:-28px;">www.sosyalmedyahaber.org</div>';
                    fb = '<div style="float:left;width:100px"><div  id="fbbhltamboy" class="fb-like" data-href="http://' + window.location.host + '"/reklamResimleri/t/' + data.d.tamboyresim + '" data-send="false" data-layout="button_count" data-width="90" data-show-faces="false"></div></div>';
                    fb2 = '<div style="float:left;width:90px"><div  id="fbbhltamboy2" class="fb-like" action="recommend"  data-href="http:/' + window.location.host + '/reklamResimleri/t/' + data.d.tamboyresim + '" data-send="false" data-layout="button_count" data-width="50" data-show-faces="false"></div></div>';
                    var send = '<div style="float:left;width:80px"><div style="width:80px" id="tfbbhl" class="fb-send" data-href="http://' + window.location.host + '/reklamResimleri/t/' + data.d.tamboyresim + '"   data-width="110" data-show-faces="false"></div></div>';
                    //var fb2 = '<div style="float:left;width:210px"><div id="fbbhl2' + value.haberID + '" class="fb-like" data-href="http://'+ window.location.host+'/Default.aspx?hid=' + value.haberID + '" data-send="true" data-layout="button_count" data-width="100" action="recommend" data-show-faces="false"></div></div>';
                    gp = '<div style="float:left;width:50px;margin-left:4px"><g:plusone size="small" href="http://' + window.location.host + '/reklamResimleri/t/' + data.d.tamboyresim + '"></g:plusone></div>';
                    tw = '<iframe allowtransparency="true" frameborder="0"  data-via="sosyalmedyahaber" scrolling="no" data-text="" src="//platform.twitter.com/widgets/tweet_button.html?url=' + eurl + '&text=sosyalmedyahaber.org&lang=tr" style="float:left;width:100px; height:20px;"></iframe>';

                    //                     tamboy = '<div id="tamBoyReklam"  class="tamboyreklam uiListLightblack "><a href="http://' + data.d.tamboylink + '" target="blank"> <img  src="http://' + window.location.host + '/reklamResimleri/t/' + data.d.tamboyresim + '"/></a></div><div style="width:100%;float:left;">' + gp + tw + send + fb + '</div>';
                    tamboy = '<div id="tamBoyReklam"  class="tamboyreklam uiListLightblack "><a href="http://' + data.d.tamboylink + '" target="blank"> <img  src="http://' + window.location.host + '/reklamResimleri/t/' + data.d.tamboyresim + '"/></a></div>';
                    // CreateNewLikeButton2('fbbhltamboy');
                    i = i + 1;
                    tamboyacik = 'T';
                } else {
                    tamboy = '<div class="tamboyreklam">Google Reklami Gelecek</div>';
                    tamboyacik = 'F';
                }

                if (data.d.y1Acik == 'T') {
                    eurl = encodeURIComponent('http://' + window.location.host + '/reklamResimleri/1/' + data.d.yayin1);

                    baslik = '<div class="fnt solyuzdeyuz" style="font-size:11px;font-weight:bold;margin-top:-28px;">www.sosyalmedyahaber.org</div>';
                    fb = '<div style="float:left;width:100px"><div  id="fbbhlyarim1" class="fb-like" data-href="http://' + window.location.host + '/reklamResimleri/1/' + data.d.yayin1 + '" data-send="false" data-layout="button_count" data-width="90" data-show-faces="false"></div></div>';
                    fb2 = '<div style="float:left;width:90px"><div  id="fbbhlyarim1fb2" class="fb-like"  action="recommend"  data-href="http://' + window.location.host + '/reklamResimleri/1/' + data.d.yayin1 + '" data-send="false" data-layout="button_count" data-width="50" data-show-faces="false"></div></div>';
                    //var fb2 = '<div style="float:left;width:210px"><div id="fbbhl2' + value.haberID + '" class="fb-like" data-href="http://' + window.location.host + '/Default.aspx?hid=' + value.haberID + '" data-send="true" data-layout="button_count" data-width="100" action="recommend" data-show-faces="false"></div></div>';
                    gp = '<div style="float:left;width:50px;margin-left:4px"><g:plusone size="small" href="http://' + window.location.host + '/reklamResimleri/1/' + data.d.yayin1 + '"></g:plusone></div> ';
                    tw = '<iframe allowtransparency="true" frameborder="0"  data-via="sosyalmedyahaber" scrolling="no" data-text="" src="//platform.twitter.com/widgets/tweet_button.html?url=' + eurl + '&text=sosyalmedyahaber.org&lang=tr" style="float:left;width:100px; height:20px;"></iframe>';
                    send = '<div style="float:left;width:80px"><div style="width:90px" id="r1fbbhl" class="fb-send" data-href="http://' + window.location.host + '/reklamResimleri/1/' + data.d.yayin1 + '" data-send="false"  data-width="110" data-show-faces="false"></div></div>';

                    //                    yarim1 = '<div id="reklamAlani1" class="reklamAlani1 uiListLightblack"><a href="http://' + data.d.reklamlink1 + '" target="blank"><img  src="http://' + window.location.host + '/reklamResimleri/1/' + data.d.yayin1 + '"/></a></div><div style="width:100%;float:left">' + gp + tw + send + fb + '</div>';
                    yarim1 = '<div id="reklamAlani1" class="reklamAlani1 uiListLightblack"><a href="http://' + data.d.reklamlink1 + '" target="blank"><img  src="http://' + window.location.host + '/reklamResimleri/1/' + data.d.yayin1 + '"/></a></div>';
                    i = i + 1;
                    yarim1acik = 'T';
                    //  CreateNewLikeButton2('fbbhlyarim1');
                } else {
                    yarim1 = '<div class="reklamAlani1">Google Reklami Gelecek</div>';
                    i = i + 1;
                    yarim1acik = 'F';
                }

                if (data.d.y2Acik == 'T') {
                    eurl = encodeURIComponent('http://' + window.location.host + '/reklamResimleri/2/' + data.d.yayin2);
                    baslik = '<div class="fnt solyuzdeyuz" style="font-size:11px;font-weight:bold;margin-top:-28px;">www.sosyalmedyahaber.org</div>';
                    fb = '<div style="float:left;width:100px"><div  id="fbbhlyarim2" class="fb-like" data-href="http://' + window.location.host + '/reklamResimleri/2/' + data.d.yayin2 + '" data-send="false" data-layout="button_count" data-width="90" data-show-faces="false"></div></div>';
                    fb2 = '<div style="float:left;width:90px"><div  id="fbbhlyarim2fb2" class="fb-like" action="recommend" data-href="http://' + window.location.host + '/reklamResimleri/2/' + data.d.yayin2 + '" data-send="false" data-layout="button_count" data-width="50" data-show-faces="false"></div></div>';
                    //var fb2 = '<div style="float:left;width:210px"><div id="fbbhl2' + value.haberID + '" class="fb-like" data-href="http://' + window.location.host + '/Default.aspx?hid=' + value.haberID + '" data-send="true" data-layout="button_count" data-width="100" action="recommend" data-show-faces="false"></div></div>';
                    gp = '<div style="float:left;width:50px;margin-left:4px"><g:plusone size="small" href="http://' + window.location.host + '/reklamResimleri/2/' + data.d.yayin2 + '"></g:plusone></div>';
                    tw = '<iframe allowtransparency="true" frameborder="0"  data-via="sosyalmedyahaber" scrolling="no" data-text="" src="//platform.twitter.com/widgets/tweet_button.html?url=' + eurl + '&text=sosyalmedyahaber.org&lang=tr" style="float:left;width:100px; height:20px;"></iframe>';
                    send = '<div style="float:left;width:80px"><div style="width:80px" id="r2fbbhl" class="fb-send" data-href="http://' + window.location.host + '/reklamResimleri/2/' + data.d.yayin2 + '" data-send="false"  data-width="110" data-show-faces="false"></div></div>';

                    //                    yarim2 = '<div id="reklamAlani2" class="reklamAlani2 uiListLightblack"><a href="http://' + data.d.reklamlink2 + '" target="blank"><img   src="http://' + window.location.host + '/reklamResimleri/2/' + data.d.yayin2 + '"/></a></div><div style="width:100%;float:left">' + gp + tw + send + fb + '</div>';
                    yarim2 = '<div id="reklamAlani2" class="reklamAlani2 uiListLightblack"><a href="http://' + data.d.reklamlink2 + '" target="blank"><img   src="http://' + window.location.host + '/reklamResimleri/2/' + data.d.yayin2 + '"/></a></div>';
                    i = i + 1;
                    yarim2acik = 'T';
                     // CreateNewLikeButton2('fbbhlyarim2');
                } else {
                    yarim2 = '<div class="reklamAlani2">Google Reklami Gelecek</div>';
                    i = i + 1;
                    yarim2acik = 'F';
                }

                seciliReklam = "y";
                reklamDegistir();
            }


        },
        error: function (xhr, data, textStatus) {
            ekranAc();
            hataver(xhr, status, Error);
        }
    });
}
var seciliReklam = null;
var yarim1acik;
var yarim2acik;
var tamboyacik;
function reklamDegistir() {
    $('#divReklamlar').html('');

    if (seciliReklam == "t") {
        seciliReklam = "y"
    } else {
        seciliReklam = "t";
    }

    if (seciliReklam == "y") {
        $('#divReklamlar').append(yarim1);
        $('#divReklamlar').append(yarim2);
        //        CreateNewLikeButton('fbbhlyarim1');
        //        CreateNewLikeButton('fbbhlyarim1fb2');
        //        CreateNewLikeButton('fbbhlyarim2');
        //        CreateNewLikeButton('fbbhlyarim2fb2');
        if (yarim1acik == 'T') {
            // reklamSayiArttir("y1");

        }
        if (yarim2acik == 'T') {
            //  reklamSayiArttir("y2");
        }
    }

    if (seciliReklam == "t") {
        $('#divReklamlar').append(tamboy);
        //        CreateNewLikeButton('fbbhltamboy');
        //        CreateNewLikeButton('fbbhltamboy2');
        if (tamboyacik == 'T') {
            //   reklamSayiArttir("t");
        }
    }
    // reklamZamanla();
    //seciliReklam = reklamTipi;
    if (reklamDegisimZamani == null) {
        reklamZamanla(5000);
    } else {
        reklamZamanla(reklamDegisimZamani);
    }

    //    var gphtml = '    <script type="text/javascript">    window.___gcfg = { lang: "tr" };    (function () {' +
    //                    'var po = document.createElement("script"); po.type = "text/javascript"; po.async = true;' +
    //                   ' po.src = "https://apis.google.com/js/plusone.js";' +
    //                  '  var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(po, s);' +
    //                   ' })();            </script>';
    //    $('#divReklamlar').append(gphtml);
}
var reklamDegisimZamani = null;
function reklamZamanla(t) {
    setTimeout("reklamDegistir()", t * 1000);
}


function videoElementOlustur2(el,isim) {

    if (isim) {
        $('#videoTV').attr("src", "/haberTV/" + isim)
    }

    $('#'+el).mediaelementplayer({
        // if the <video width> is not specified, this is the default
        defaultVideoWidth: 150,
        // if the <video height> is not specified, this is the default
        defaultVideoHeight: 200,
        // if set, overrides <video width>
        videoWidth: -1,
        // if set, overrides <video height>
        videoHeight: -1,
        // width of audio player
        audioWidth: 200,
        // height of audio player
        audioHeight: 30,
        // initial volume when the player starts
        startVolume: 0.8,
        // useful for <audio> player loops
        loop: false,
        // enables Flash and Silverlight to resize to content size
        enableAutosize: false,
        // the order of controls you want on the control bar (and other plugins below)
        features: ['playpause','fullscreen',  'progress', 'current', 'duration', 'tracks', 'volume'],

        // automatically selects a <track> element
        startLanguage: '',
        // a list of languages to auto-translate via Google
        translations: [],
        // a dropdownlist of automatic translations
        translationSelector: false,
        // key for tranlsations
        googleApiKey: ''

    });
}


function videoElementOlustur(isim) {

    if (isim) {
        $('#videoTV').attr("src", "/haberTV/" + isim)
    }
    var w = 250;
    var h = $('#tvSabit').height();
    if ($('#haberTV').width() > 339) {
        $('#videoTV').attr("width", $('#haberTV').width() + "px");
        $('#videoTV').attr("height", h + "px");
        w = $('#haberTV').width();
    } else {
        $('#videoTV').attr("width", 340);
    }
    eurl = encodeURIComponent('http://' + window.location.host + '/Default.aspx?tv=' + isim);
    var fb3 = '<div style="float:left;width:60px"><div id="fbteve" class="fb-like" data-href="http://' + window.location.host + '/Default.aspx?tv=' + isim + '" data-send="false" data-layout="button_count" data-width="70"  data-show-faces="false"></div></div>';
    var fb2 = '<div style="float:left;width:105px"><div id="fbteve" class="fb-like" data-href="http://' + window.location.host + '/Default.aspx?tv=' + isim + '" data-send="false" data-layout="button_count" data-width="70" action="recommend" data-show-faces="false"></div></div>';
    var fb = '<div style="float:left;width:60px"><div  id="fbteve2" class="fb-like" data-href="http://www.facebook.com/pages/Sosyal Medya Tv Haber/209184115834750" data-send="false" data-layout="button_count" data-width="50"  data-show-faces="false"></div></div>';
    var gp2 = '<div style="float:left;width:40px"><g:plusone size="small" href="http://' + window.location.host + '/Default.aspx??tv=' + isim + '"></g:plusone></div>';
    var tw = '<iframe allowtransparency="true" frameborder="0"  data-via="sosyalmedyahaber" scrolling="no"  src="//platform.twitter.com/widgets/tweet_button.html?url=' + eurl + '&text= ' + eurl + '&lang=tr" style="float:left;width:65px; height:20px;"></iframe>';

    //$('#fbTvBegen').append(fb2);
    var tw2 = '<div style="float:left;width:110px"> <iframe allowtransparency="true" frameborder="0" scrolling="no" src="//platform.twitter.com/widgets/follow_button.html?screen_name=SosyalMdyaTvHbr&lang=tr" style="width:110px; float:left;height:20px;padding-left:5px"></iframe></div>';
    var send = '<div style="float:left;width:65px"><div style="width:65px"  class="fb-send" data-href="http://' + window.location.host + '/Default.aspx?tv=' + isim + '"   data-width="110" data-show-faces="false"></div></div>';
//    $('#fbTvBegen').append(gp2);
//    $('#fbTvBegen').append(tw2);
//    $('#fbTvBegen').append(tw);
//    $('#fbTvBegen').append(send).append(fb3);
//    CreateNewLikeButton2('fbteve');
//    CreateNewLikeButton2('fbteve2');
    $('#fbTvBegen').append(tw);
    $('#fbTvBegen').append(fb2);
    CreateNewLikeButton2('fbteve');
    //   $('#fbTvBegen').append(fb2);
    //CreateNewLikeButton(window.location.host + 'http://' + window.location.host + '/Default.aspx?tv=' + isim, 'fbTvBegen',1);
    $('#videoTV').mediaelementplayer({

        plugins: ['flash'],
        flashName: 'flashmediaelement.swf',
        defaultVideoWidth: w,
        // if the <video height> is not specified, this is the default
        defaultVideoHeight: h,
        // if set, overrides <video width>
        videoWidth: w,
        // if set, overrides <video height>
        videoHeight: h,
        // width of audio player
        audioWidth: 200,
        // height of audio player
        audioHeight: 30,
        // initial volume when the player starts
        startVolume: 0.0,
        // useful for <audio> player loops
        loop: true,
        pauseOtherPlayers: false,
        // enables Flash and Silverlight to resize to content size
        enableAutosize: false,
        // the order of controls you want on the control bar (and other plugins below)
        features: ['fullscreen', 'volume', 'progress', 'current', 'duration', 'tracks'],

        // automatically selects a <track> element
        startLanguage: '',
        // a list of languages to auto-translate via Google
        translations: [],
        // a dropdownlist of automatic translations
        translationSelector: false,
        // key for tranlsations
        googleApiKey: '',
        success: function (mediaElement, domObject) {
            mediaElement.play();
        }

    });
    $('#videoTV').unbind('click');

}
function yayinListesiGetir() {
    //   ekranKilitle("Yayın Listesi Yükleniyor");
    var json = {};
    $.ajax({
        type: "POST",
        contentType: "application/json; charset=utf-8",
        url: "mainFuncs.aspx/tvYayinListesiGetir",
        data: $.toJSON(json),
        dataType: "json",
        success: function (data) {
            ekranAcAnket();
            $('#yayinAkisi').html('');
            if (data.d != null) {
                $.each(data.d, function (key, value) {
                    var ht = '<div style="float:left;width:98%" id="vid' + value.yayinID + '" class="ui-state-default"><span style="float:left;width:100%" ><span  style="float:left;width:34px">' + value.baslangicSaati + '</span>' + value.programAdi + '</span></div>';
                    $('#yayinAkisi').append(ht);
                    //$('#vid' + value.yayinID).css("cursor", "pointer").click(function () { videoOynat(value.videoDosyasi) });
                })
            }
        },
        error: function (xhr, data, textStatus) {
            ekranAcAnket();
            hataver(xhr, status, Error);
        }
    });
}

